const { DataTypes } = require('sequelize');
const sequelize = require('../db');

// 定义数据模型
exports.blogTypeModel = sequelize.define(
	'blogType',
	{
		name: {
			type: DataTypes.STRING,
			allowNull: false,
			comment: '名称'
		},
		articleCount: {
			type: DataTypes.INTEGER,
			allowNull: false,
			comment: '文章数量',
			defaultValue: 0
		},
		order: {
			type: DataTypes.INTEGER,
			allowNull: false,
			comment: '排序',
			defaultValue: 1
		}
	},
	{
		freezeTableName: true,
		deletedAt: true,
		defaultScope: {
			attributes: { exclude: ['createdAt', 'updatedAt'] } // 默认排除 createdAt 和 updatedAt 字段
		}
	}
);
